/*  1:   */ package org.intellij.html;
/*  2:   */ 
/*  3:   */

import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.filters.AndFilter;
import com.intellij.psi.filters.ClassFilter;
import com.intellij.psi.filters.XmlTextFilter;
import com.intellij.psi.meta.MetaDataContributor;
import com.intellij.psi.meta.MetaDataRegistrar;
import com.intellij.util.ReflectionUtil;
import org.intellij.plugins.relaxNG.compact.psi.RncFile;
import org.intellij.plugins.relaxNG.compact.psi.RncNsDecl;
import org.intellij.plugins.relaxNG.compact.psi.impl.RncDocument;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */ 
/* 16:   */ public class RngHtml5MetaDataContributor
/* 17:   */   implements MetaDataContributor
/* 18:   */ {
/* 19:   */   public void contributeMetaData(MetaDataRegistrar paramMetaDataRegistrar)
/* 20:   */   {
/* 21:38 */     paramMetaDataRegistrar.registerMetaData(new AndFilter(new ClassFilter(RncDocument.class), new MyRncNamespaceFilter(new String[] { "http://www.w3.org/1999/html", "http://www.w3.org/1999/xhtml" })), RelaxedHtmlFromRngNSDescriptor.class);
/* 22:   */   }
/* 23:   */   
/* 24:   */   private static class MyRncNamespaceFilter
/* 25:   */     extends XmlTextFilter
/* 26:   */   {
/* 27:   */     MyRncNamespaceFilter(String... paramVarArgs)
/* 28:   */     {
/* 29:48 */       super();
/* 30:   */     }
/* 31:   */     
/* 32:   */     public boolean isClassAcceptable(Class paramClass)
/* 33:   */     {
/* 34:52 */       return ReflectionUtil.isAssignable(RncDocument.class, paramClass);
/* 35:   */     }
/* 36:   */     
/* 37:   */     public boolean isAcceptable(Object paramObject, PsiElement paramPsiElement)
/* 38:   */     {
/* 39:56 */       if (!(paramObject instanceof RncDocument)) {
/* 40:57 */         return false;
/* 41:   */       }
/* 42:60 */       PsiFile localPsiFile = ((RncDocument)paramObject).getContainingFile();
/* 43:61 */       String str = null;
/* 44:   */       Object localObject2;
/* 45:62 */       if ((localPsiFile instanceof RncFile)) {
/* 46:63 */         for (localObject2 : ((RncFile)localPsiFile).getDeclarations()) {
/* 47:64 */           if ((localObject2 instanceof RncNsDecl))
/* 48:   */           {
/* 49:65 */             str = localObject2.getDeclaredNamespace();
/* 50:66 */             break;
/* 51:   */           }
/* 52:   */         }
/* 53:   */       }
/* 54:71 */       if (str != null) {
/* 55:72 */         for (localObject2 : this.myValue) {
/* 56:73 */           if (localObject2.equals(str)) {
/* 57:73 */             return true;
/* 58:   */           }
/* 59:   */         }
/* 60:   */       }
/* 61:76 */       return false;
/* 62:   */     }
/* 63:   */   }
/* 64:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.html.RngHtml5MetaDataContributor

 * JD-Core Version:    0.7.0.1

 */